/*
 * Tool for random evaluation
 * Processes input file and count lookup matches for different cases
 *
 * @author Paul Wagner
 *
 */
package complet.app.tool.paramlearning;

import complet.db.Evaluator;
import complet.helper.ConfigHelper;
import complet.helper.IOHelper;
import java.util.Random;

public class random {

    public static void main(String[] args) {
        Random rnd = new Random();
        int b1, b2, b3, b4;
        double b_cg = 2000d;
        double[] cg;
        double s_cg;


        // Config Values
        ConfigHelper.IN_PATH = "E:\\paul\\Dokumente\\MyDocuments\\NetBeans Workspace\\Completion\\inputfiles\\wikipedia\\wiki.txt";
        ConfigHelper.DB_PATH = "E:\\paul\\Dokumente\\MyDocuments\\NetBeans Workspace\\Completion\\dbs\\db_ngrams_r5.db";

        ConfigHelper.BUFFER = true;

        Evaluator evl = new Evaluator();
        evl.setAnz_stnce(2000);
        evl.setRandom_stnce(false);

        int c = 0;
        int p1, p2, p3, p4;
        while (c++ < 50000) {

            p1 = 0;
            p2 = rnd.nextInt(100);
            p3 = rnd.nextInt(100);
            p4 = rnd.nextInt(100);
            evl.setP1(p1);
            evl.setP2(p2);
            evl.setP3(p3);
            evl.setP4(p4);

            evl.eval();

            cg = evl.getLoc_cg();
            s_cg = cg[0] + cg[1] + cg[2];

            if (s_cg > b_cg) {
                b1 = p1;
                b2 = p2;
                b3 = p3;
                b4 = p4;
                b_cg = s_cg;

                IOHelper.log("(random) Found better params at " + c + ". try: " + b1 + ", " + b2 + ", " + b3 + ", " + b4 + " with summed cg " + b_cg);
            } else {
                IOHelper.log("(random) Found no better params at " + c + ". try: " + p1 + ", " + p2 + ", " + p3 + ", " + p4 + " with summed cg " + s_cg);
            }
        }

    }
}
